package com.qst.db;

import java.sql.DriverManager;
import java.sql.SQLException;
import com.mysql.jdbc.Connection;

public class DBmanager {
	private static final String driverclass = "com.mysql.jdbc.Driver";
	private static final String connstr = "jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=UTF8";
	private static final String user = "root";
	private static final String pass = "router";

	public  DBmanager() {
		
	}
	public static Connection getConn() {
		Connection conn = null;
		try {
			Class.forName(driverclass);
	
			try {
				conn = (Connection) DriverManager.getConnection(connstr, user, pass);
			
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return conn;    
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		DBmanager.getConn();
	}

}
 